<template>
    <div>
        <search @tosearch="tosearch" @toclear="toclear">
            <template v-slot:df="scope">
                <div>
                    <van-card v-for="v in searchlist" :num="'1 (张)'" price="2.00" origin-price="10.00" desc="描述信息"
                        title="商品标题" :thumb="shopitem" @click="todetail(3)">
                        <template v-slot:price="scope">
                            ￥2.00-3.00
                        </template>
                    </van-card>
                </div>
            </template>
        </search>
    </div>
</template>

<script lang="ts" setup>
import { ref, onDeactivated } from 'vue';
import { useRouter } from 'vue-router';
//
import shopitem from '../assets/20230517164305.png'
const router = useRouter()
//
const searchlist = ref([])
const tosearch = (e) => {
    console.log(e)
    searchlist.value = []
    setTimeout(() => {
        searchlist.value = [1, 1, 1]
    }, 500)
}
const toclear = () => {
    console.log(1111)
}
const todetail: Function = (id: any) => {
    router.push({ path: '/detail', query: { id } })
}
</script>